var hideMore=document.getElementsByClassName("hideMore")[0];
var hideMusic=document.getElementsByClassName("hideMusic")[0];
var img1 =document.getElementById("img1");
function showMore(){
    // img1.src="../../L-img/L-image/L-up.png";
    hideMore.style.display="block";
    hideMore.style.opacity="1";
    hideMore.style.transition=".5s";
}
function offMore(){
    // img1.src="../../L-img/L-image/L-down.png";
    hideMore.style.display="none";
    hideMore.style.opacity="0";
    hideMore.style.transition="0";
}
// 侧边栏的置顶
var side=document.getElementsByClassName("side")[0];
document.onscroll=function(){
    var top=document.documentElement.scrollTop;
    if(top>500){
        side.style.opacity="1";
    }else {
        side.style.opacity="0";
    }
}
function toTop() {
    var backTopTimer = setInterval(function () {
        var topH = document.documentElement.scrollTop || document.body.scrollTop;
        var backTopSpeed = Math.floor(-topH / 8);
        if (topH > 0) {
            document.documentElement.scrollTop = document.body.scrollTop = topH + backTopSpeed;
        } else {
            clearInterval(backTopTimer);

        }
    }, 100);
}
//登录成功以及出现退出登录
var name=document.getElementsByClassName('userName')[0];
var login=document.getElementsByClassName('login')[0];
var persons=document.getElementsByClassName('persons')[0];
var out=document.getElementsByClassName('out')[0];
var hideLogOut = document.getElementsByClassName('hideLogOut')[0];
var hideLogOutContent = document.getElementsByClassName('hideLogOutContent')[0];
var logOutNoBtn=document.getElementsByClassName('logOutNoBtn')[0];
var logOutYesBtn=document.getElementsByClassName('logOutYesBtn')[0];
if(localStorage.getItem('userHao')!=null || localStorage.getItem('sign')==1){
    login.style.display='none';
    persons.style.display='block';
}
console.log(localStorage.getItem('userHao'))
console.log(localStorage.getItem('password'))
out.onclick=function(){
    setTimeout(function(){
        hideLogOut.style.display = 'block';
        hideLogOutContent.style.opacity = '1';
        hideLogOutContent.style.transform = "translate(" + -50 + "%," + 400 + "px)";
    },1)
    logOutNoBtn.onclick = function(){
        hideLogOutContent.style.opacity = '0';
        hideLogOutContent.style.transform = "translate(" + -50 + "%," + -400 + "px)";
        hideLogOut.style.display = 'none';
    }
//点击确认会退出登录
    logOutYesBtn.onclick = function(){
        hideLogOutContent.style.opacity = '0';
        hideLogOutContent.style.transform = "translate(" + -50 + "%," + -400 + "px)";
        hideLogOut.style.display = 'none';
        persons.style.display='none';
        login.style.display='block';
        localStorage.removeItem('userHao');
        localStorage.removeItem('password');
        localStorage.removeItem('sign');
        window.location.href="http://localhost:8080/future/out";
    }


}

// 判断是否登录
var hideVipLoad=document.getElementsByClassName('hideVipLoad')[0];
var hideVipLoadForm=document.getElementsByClassName('hideVipLoadForm')[0];
var vipBtn=document.getElementsByClassName('vipBtn')[0];
var loadBtn=document.getElementsByClassName('loadBtn')[0];
var closeVip=document.getElementsByClassName('closeVip')[0];
var myMusic=document.getElementsByClassName('myMusic')[0];
// vip的界面
vipBtn.onclick=function(){
    if(localStorage.getItem('userHao')!=null|| localStorage.getItem('sign')==1){
        window.location.href='http://localhost:8080/future/toVIPpaper';
    }else{
        hideVipLoad.style.display='block';
        hideVipLoadForm.style.opacity='1';
        closeVip.onclick=function(){
            hideVipLoad.style.display='none';
            hideVipLoadForm.style.opacity='0';
        }
        loadBtn.onclick=function(){
            window.location.href='http://localhost:8080/future/loginpage';
        }
    }

}
// 我的音乐的界面
myMusic.onclick=function(){
    if(localStorage.getItem('userHao')!=null|| localStorage.getItem('sign')==1){
        window.location.href='http://localhost:8080/future/toMyMusicpaper';
    }else{
        hideVipLoad.style.display='block';
        hideVipLoadForm.style.opacity='1';
        closeVip.onclick=function(){
            hideVipLoad.style.display='none';
            hideVipLoadForm.style.opacity='0';
        }
        loadBtn.onclick=function(){
            window.location.href='http://localhost:8080/future/loginpage';
        }
    }
}

// // 判断是否登录 end